const Result = require("../utils/result");
module.exports = () => {
  return async function errorHandler(ctx, next) {
    try {
      await next();
    } catch (error) {
      ctx.body = Result.ERROR(500, error.toString());
    }
  };
};
